<div class="modal-dialog">
    <div class="modal-content">
        <form role="form" method="post" id="addForm" action="{:U('index/password')}">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">修改密码</h4>
            </div>
            <div class="modal-body">

                <div class="form-group">
                    <label for="old_password">原始密码</label>
                    <input type="password" class="form-control" id="old_password" name="old_password">
                </div>
                <div class="form-group">
                    <label for="password">新密码</label>
                    <input type="password" class="form-control" id="password" name="password">
                </div>
                 <div class="form-group">
                    <label for="re_password">确认新密码</label>
                    <input type="password" class="form-control" id="re_password" name="re_password">
                </div>

            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-danger">确认保存</button>
            </div>
        </form>
    </div>
    <script src="/Public/assets/js/validation/bootstrapValidator.js" type="text/javascript" charset="utf-8"></script>
    <script src="/Public/assets/js/jquery.form.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
    	$("#addForm").bootstrapValidator({              
    	                excluded: [':disabled'],
    	                feedbackIcons: {
    	                    valid: 'glyphicon glyphicon-ok',
    	                    invalid: 'glyphicon glyphicon-remove',
    	                    validating: 'glyphicon glyphicon-refresh'
    	                },
    	                submitHandler: function (validator, form, submitButton) {
    	                 	var loader = loading();
    	                 	$("#addForm").ajaxSubmit(function(result){ 
    	                 		loader.remove();
    	                 		result = JSON.parse(result);
    	                 		if(result.status == 'success'){ 
    	                 			tips('密码修改成功');
    	                 			$("#addForm").parents(".modal").modal("hide");
    	                 		}else{ 
    	                 			tips(result.message,'danger');
    	                 			validator.disableSubmitButtons(false);
    	                 		}
    	                 	});
    	                },
    	                fields: {
    	                    old_password:{ 
    	                    	validators: { 
    	                    		notEmpty: { 
    	                    			message: '原始密码不能为空'
    	                    		},
    	                    		stringLength:{ 
    	                    			message: '密码长度必须为6-16位',
    	                    			min:6,
    	                    			max:16
    	                    		}
    	                    	}
    	                    },
    	                    password:{ 
    	                    	validators: { 
    	                    		notEmpty: { 
    	                    			message: '新密码不能为空'
    	                    		},
    	                    		stringLength:{ 
    	                    			message: '密码长度必须为6-16位',
    	                    			min:6,
    	                    			max:16
    	                    		}
    	                    	}
    	                    },
    	                    re_password:{ 
    	                    	validators: { 
    	                    		notEmpty: { 
    	                    			message: '确认密码不能为空'
    	                    		},
    	                    		identical: {
				                        field: 'password',
				                        message: '两次密码输入不相同'
				                    }
    	                    	}
    	                    }
    	                }
    	            });
    	
    </script>